<template>
  <Nav :showBlack="true" :title="all_data.name"></Nav>
  <div class="page">
     <div class="spc-img" :style="{ backgroundImage: `url(${all_data.cover_image})`}"></div>
     <div class="spc-title">
       专区介绍
     </div>
    <div class="spc-info" v-if="all_data.descript">
      {{removeTags(all_data.descript)}}
    </div>
    <div class="spc-title2">
      <div class="left">本系列藏品</div>
      <div class="right">{{res_data.length}} 件藏品</div>
    </div>
    <div class="spc-item" v-for="(item,index) in res_data" @click="goDetail(item.id)" :key="item.id" v-if="res_data.length > 0">
       <div class="itemImg imgBox" :style="{ backgroundImage: `url(${item.cover_image})`}"></div>
       <div class="spc-item-title">
         <div class="left">{{item.name}}</div>
         <div class="control">
           <div class="viewBox">
             <img src="../assets/look.png" alt="">
             <span>{{item.browse_count}}</span>
           </div>
           <div class="likeBox" v-show="item.has_like == 0" @click="collection(item)">
             <img src="../assets/like.png" alt="">
             <span>{{item.like_count}}</span>
           </div>
           <div class="likeBox" v-show="item.has_like == 1" @click="uncollection(item)">
             <img src="../assets/collect-a.png" alt="">
             <span>{{item.like_count}}</span>
           </div>
         </div>
       </div>
       <div class="spc-item-info">
         {{removeTags(item.descript)}}
       </div>
    </div>
  </div>
</template>
<script setup>
import Nav from "@/components/nav.vue";
import { removeTags } from '@/utils/utils'
import {useRoute, useRouter} from 'vue-router'
import { onMounted, reactive, ref, onActivated, nextTick } from 'vue';
import { api } from "@/utils/api.js";
import { collection, uncollection } from "@/hooks/hooks.js";

let all_data = ref({});
let res_data = reactive([]);
const router = useRouter();
const route = useRoute();

async function render() {
  const res = await api('/api/digitalzq/zq_detail','post',{id:route.query.id})
  all_data = res;
  // console.log(all_data);
  res_data.push(...res.collection_classify_list);
  console.log(res_data);
}
const goDetail = (id) => {
  router.push({path:'detail',query:{id:id}})
}

onMounted(() => {
  render();
})

</script>
<style scoped lang="scss">
.page {
  width: 100%;
  height: 100%;
  background: #262739;
  padding: 156px 56px 0 56px;
}
.spc-title {
  font-size: 46px;
  color:#fff;
  margin-bottom: 40px;
}
.spc-title2 {
  display: flex;
  justify-content: space-between;
  color:#fff;
  margin-bottom: 60px;
  .left {
    font-size:46px;
  }
  .right {
    font-size: 36px;
  }
}
.spc-item-title {
  display: flex;
  justify-content: space-between;
  color:#fff;
  font-size: 46px;
}
.control {
  display: flex;
  justify-content: space-between;
  height: 90px;
  > div {
    margin-left: 40px;
    font-size: 40px;
    img {
      height: 40px;
      width: auto;
      margin-right:10px;
      vertical-align: text-bottom;
    }
  }
}
.spc-item-info {
  font-size: 36px;
  color:#fff;
  line-height: 1.6;
}
.itemImg {
  margin-bottom: 50px;
}
.spc-info {
  font-size: 36px;
  color:#fff;
  line-height: 1.6;
  margin-bottom: 60px;
}
.spc-item {
  border:1px solid #47484a;
  border-radius: 40px;
  padding: 50px 50px 40px 50px;
  margin-bottom: 40px;
  .itemImg {
    width: 100%;
    height: 726px;
    border-radius: 32px;
  }
}
.spc-img {
  width: 100%;
  height: 500px;
  border-radius: 20px;
  margin-bottom: 53px;
  background-repeat: no-repeat;
  background-size: cover;
}

.logo {
  height: 50px;
  width: auto;
}
.vidoeBox {
  height: 626px;
  width: 100%;
  background: #000;
}
#video {
  width: 100%;
}
.bottom {
  height: calc(100% - 626px);
  background: #f6f0e6;
  border-radius: 40px 40px 0 0;
  padding: 83px;
  .title {
    font-size: 46px;
    margin-bottom: 34px;
    font-weight: bold;
  }
  .min-title {
    font-size: 32px;
    line-height: 1.6;
  }
}
</style>
